window: Don't manually queue a draw on the new focus widget
authorTimm Bäder <mail@baedert.org>
Tue, 15 Jan 2019 05:11:03 +0000 (06:11 +0100)
committerTimm Bäder <mail@baedert.org>
Wed, 16 Jan 2019 18:01:38 +0000 (19:01 +0100)
This is either unneeded and OK to remove, or it is needed and there's a
bug somewhere else.

gtk/gtkwindow.c

index 75e962ed429c192de1c5dcf523188ae00aff2d70..4c6162cf5cdb96e09db19108846996235f906c08 100644 (file)
@@ -7749,33 +7749,24 @@ gtk_window_real_set_focus (GtkWindow *window,
 {
   GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
   GtkWidget *old_focus = priv->focus_widget;
-  gboolean had_default = FALSE;
-  gboolean focus_had_default = FALSE;
-  gboolean old_focus_had_default = FALSE;
 
   if (old_focus)
     {
       g_object_ref (old_focus);
       g_object_freeze_notify (G_OBJECT (old_focus));
-      old_focus_had_default = gtk_widget_has_default (old_focus);
     }
   if (focus)
     {
       g_object_ref (focus);
       g_object_freeze_notify (G_OBJECT (focus));
-      focus_had_default = gtk_widget_has_default (focus);
     }
 
-  if (priv->default_widget)
-    had_default = gtk_widget_has_default (priv->default_widget);
-
   if (priv->focus_widget)
     {
       if (gtk_widget_get_receives_default (priv->focus_widget) &&
          (priv->focus_widget != priv->default_widget))
         {
           _gtk_widget_set_has_default (priv->focus_widget, FALSE);
-         gtk_widget_queue_draw (priv->focus_widget);
 
          if (priv->default_widget)
             _gtk_widget_set_has_default (priv->default_widget, TRUE);
@@ -7816,29 +7807,13 @@ gtk_window_real_set_focus (GtkWindow *window,
         g_object_notify (G_OBJECT (priv->focus_widget), "is-focus");
     }
 
-  /* If the default widget changed, a redraw will have been queued
-   * on the old and new default widgets by gtk_window_set_default(), so
-   * we only have to worry about the case where it didn't change.
-   * We'll sometimes queue a draw twice on the new widget but that
-   * is harmless.
-   */
-  if (priv->default_widget &&
-      (had_default != gtk_widget_has_default (priv->default_widget)))
-    gtk_widget_queue_draw (priv->default_widget);
-  
   if (old_focus)
     {
-      if (old_focus_had_default != gtk_widget_has_default (old_focus))
-       gtk_widget_queue_draw (old_focus);
-       
       g_object_thaw_notify (G_OBJECT (old_focus));
       g_object_unref (old_focus);
     }
   if (focus)
     {
-      if (focus_had_default != gtk_widget_has_default (focus))
-       gtk_widget_queue_draw (focus);
-
       g_object_thaw_notify (G_OBJECT (focus));
       g_object_unref (focus);
     }